package com.ximu.test.struts2;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;

public class HelloStruts2 extends ActionSupport {

	private String username;
	
	private HttpServletResponse reponse = ServletActionContext.getResponse();
	
	public String test(){
		//System.out.println(username);
		HttpServletRequest request  = ServletActionContext.getRequest();
		request.setAttribute("struts","struts------------");
		Map<String, String[]> param = request.getParameterMap();
		//System.out.println(param.get("username")[0]);
		for(Map.Entry<String, String[]> entry:param.entrySet()){
			System.out.println(entry.getValue()[0]);
		}
		return SUCCESS;
	}
	
	public void setUsername(String username){
		this.username = username;
	}
	
	public String getUsername(){
		return username;
	}
}
